package com.yanqu.road.server.cmd.zhaoshang;

import com.yanqu.road.pb.zhaoshang.ZhaoShangProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.zhaoshang.ZsMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C2_ZHAO_SHANG_PROJECT_SEARCH, desc = "查询玩家相关的项目")
public class ZsProjectSearchCmd extends CrossCommand {

    private long searchUserAliasId;
    private int listSizeLimit;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        ZhaoShangProto.CrossZsProjectListReqMsg reqMsg = ZhaoShangProto.CrossZsProjectListReqMsg.parseFrom(packet.getBytes());
        searchUserAliasId = reqMsg.getSearchUserAliasId();
        listSizeLimit = reqMsg.getListNumLimit();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        ZsMgr.listProjects(searchUserAliasId, serverId, packet.getPlayerId(), listSizeLimit, -1);
    }

    @Override
    public void sendData() {

    }
}
